package org.kfive.nova.thread;

import com.google.common.reflect.TypeToken;
import com.google.common.util.concurrent.*;
import com.sun.istack.internal.Nullable;

import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 16-5-29
 * Time: 下午5:07
 * To change this template use File | Settings | File Templates.
 */
public class GuavaMultiThread {

    public static void main(String[] args) {

        ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10));
        ListenableFuture explosion = executorService.submit(new Callable() {
            @Override
            public Object call() throws Exception {
                return null;  //To change body of implemented methods use File | Settings | File Templates.
            }
        });
        Futures.addCallback(explosion,new FutureCallback() {
            @Override
            public void onSuccess(@Nullable Object o) {
                //To change body of implemented methods use File | Settings | File Templates.
            }

            @Override
            public void onFailure(Throwable throwable) {
                //To change body of implemented methods use File | Settings | File Templates.
            }
        });
        TypeToken<List<String>> typeToken = new TypeToken<List<String>>() {
        };

    }
}
